<?php
global $_GPC, $_W;
$GLOBALS['frames'] = $this->getMainMenu();
$pageindex = max(1, intval($_GPC['page']));
$pagesize=10;
$sql="select a.* ,b.students_name,b.parents_name,b.img,c.teacher_name from " . tablename("snx_exchange") . " a"  . " left join " . tablename("snx_users") . " b on b.id=a.user_id left join " . tablename("snx_teacher") . " c on c.id=a.hx_id WHERE a.prize_id =".$_GPC['prize_id']." order by a.time DESC";
$select_sql =$sql." LIMIT " .($pageindex - 1) * $pagesize.",".$pagesize;
$list = pdo_fetchall($select_sql);
$total=pdo_fetchcolumn("select count(*) from " . tablename("snx_exchange") . " a"  . " left join " . tablename("snx_users") . " b on b.id=a.user_id WHERE a.prize_id =".$_GPC['prize_id']."");
$pager = pagination($total, $pageindex, $pagesize);
// if($_GPC['op']=='upd'){
// 	$res=pdo_update('snx_exchange',array('state'=>2),array('id'=>$_GPC['id']));
// 	if($res){
// 		message('修改成功',$this->createWebUrl('receivelist',array('prize_id' => $_GPC['prize_id'],'type'=>$_GPC['type'])),'success');
// 	}else{
// 		message('修改失败',$this->createWebUrl('receivelist',array('prize_id' => $_GPC['prize_id'],'type'=>$_GPC['type'])),'error');
// 	}
// }

// if(checksubmit('submit3')){
// 	$rst=pdo_get('zh_jdgjb_jfgoods',array('id'=>$_GPC['prize_id']));
//     $res=pdo_update('snx_exchange',array('state'=>2,'kd_num'=>$_GPC['kd_num'],'kd_name'=>$_GPC['kd_name']),array('id'=>$_GPC['fh_id']));
//     if($res){
//         message('发货成功！', $this->createWebUrl('receivelist',array('prize_id' => $_GPC['prize_id'],'type'=>$rst['type'])), 'success');
//     }else{
//         message('发货失败！','','error');
//     }
// }
include $this->template('web/receivelist');